Skip to content

fix(builtins): URL-encode query params and form body in HTTP builtin#1008

Merged
chaliy merged 1 commit intomainfrom
fix/issue-1001-url-form-injection
Apr 2, 2026
Merged

fix(builtins): URL-encode query params and form body in HTTP builtin#1008
chaliy merged 1 commit intomainfrom
fix/issue-1001-url-form-injection

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 2, 2026

Summary

  • build_url_with_query and build_form_body now use url::form_urlencoded::Serializer for proper encoding
  • Values containing &, =, # are properly encoded, preventing parameter/field injection
  • Added threat model entries TM-NET-019 and TM-NET-020

What & Why

Both functions concatenated user-supplied values without URL-encoding. A value like foo&admin=true would inject an additional parameter. Now uses the url crate's form_urlencoded::Serializer which handles all special characters per RFC.

Tests Added

  • test_query_param_injection_encoded — verifies & in value doesn't inject params
  • test_query_param_normal_value — happy path
  • test_form_body_injection_encoded — verifies & in form value doesn't inject fields
  • test_form_body_normal_value — happy path

Closes #1001

Closes #1001 — build_url_with_query and build_form_body concatenated
values without URL-encoding, allowing parameter/field injection via
special characters (&, =, #). Now uses url::form_urlencoded::Serializer.
@chaliy chaliy merged commit 49f64af into main Apr 2, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-1001-url-form-injection branch April 2, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query parameter and form body injection via unencoded values in HTTP builtin

1 participant